package com.example.food_contract_system.controller;

import com.example.food_contract_system.service.FoodService;
import com.example.food_contract_system.service.TypeService;
import com.example.food_contract_system.util.R;
import com.example.food_contract_system.vo.SelectByKeyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author LiHaoyang
 * @date 2023/7/8  19:48
 **/
@RestController
@RequestMapping("/common")
public class CommonController {

    @Autowired
    private FoodService foodService;
    @Autowired
    private TypeService typeService;

    @GetMapping("/getFoodAll")
    public R getFoodAll(){
        R result = foodService.getFoodAll();
        return result;
    }

    @GetMapping("/getType")
    public R getType(){
        R result = typeService.getType();
        return result;
    }

    @PostMapping("/selectByKey")
    public R selectByKey(@RequestBody SelectByKeyVo selectByKeyVo){
        R result = foodService.selectByKey(selectByKeyVo);
        return result;
    }
}
